package com.cloud.code.算法.链表.反转链表;

import com.cloud.code.算法.链表.LinkedList;

public class Test {

    public static void main(String[] args) {
        LinkedList list = new LinkedList();
        list.addFrist(1);
        list.addFrist(2);
        list.addFrist(3);
        list.addFrist(4);

        System.out.println(list);

    }

    private static LinkedList.Node reverseList(LinkedList.Node head) {


        LinkedList.Node pre = null;
        LinkedList.Node cur = head;
        while (cur != null){
            LinkedList.Node next = cur.next;
            cur.next = pre;
            pre = cur;
            cur = next;
        }

        return pre;
    }
}
